#!/bin/sh

# exit on error
set -e

VERSION=master  # 27978837
BASEDIR="$PWD"
SRCDIR="$BASEDIR/ompi-hello"

# enable parallel build
export MAKEFLAGS="-j `nproc`"

if [ ! -d "$SRCDIR" ]; then
    # Checkout code
    git clone --depth 1 --branch $VERSION https://github.com/mikelangelo-project/ompi-hello.git
    cd "$SRCDIR"
    git checkout -b ompi-osv
    cd "$BASEDIR"
fi

# Open MPI should be already installed - header files, dev libs.
(cd $SRCDIR && make all)

echo "
/usr/lib/mpi_hello.so:              ${SRCDIR}/mpi_hello.so
" > "$BASEDIR/usr.manifest"
